<script setup>
import { defineProps } from 'vue'
// 从父组件拿到title
defineProps({
  title: {
    type: String,
    required: true
  }
})
</script>
<template>
  <el-card>
    <template #header>
      <div class="card-header">
        <span>{{ title }}</span>
        <!-- 具名插槽，名为 extra，允许在父组件中传递额外的内容 -->
        <slot name="extra"></slot>
      </div>
    </template>
    <!-- 内容主体部分，默认插槽 -->
    <slot></slot>
    <template #footer>Footer content</template>
  </el-card>
</template>
<style scoped>
.card-header {
  display: flex;
  justify-content: space-between; /* 左右对齐 */
}
</style>
